package com.lanyou.esb.redis.vo;

import com.lanyou.esb.entity.IfReqQuantity;

/**
 * 接口请求量控制
 * 
 * @author Davey.wu
 */
public class IfReqQuantityVo {
	/** 接口请求量控制表ID **/
	private String id;
	/** 接口表ID **/
	private String ifId;
	/** 请求阀值 **/
	private int reqThreshold;
	/** 请求最大值 **/
	private int reqMax;
	/** 请求单位,现在只以天为单位 **/
	private String reqUnit;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getIfId() {
		return ifId;
	}

	public void setIfId(String ifId) {
		this.ifId = ifId;
	}

	public int getReqThreshold() {
		return reqThreshold;
	}

	public void setReqThreshold(int reqThreshold) {
		this.reqThreshold = reqThreshold;
	}

	public int getReqMax() {
		return reqMax;
	}

	public void setReqMax(int reqMax) {
		this.reqMax = reqMax;
	}

	public String getReqUnit() {
		return reqUnit;
	}

	public void setReqUnit(String reqUnit) {
		this.reqUnit = reqUnit;
	}

	public static IfReqQuantityVo getInstance(IfReqQuantity target) {
		IfReqQuantityVo ifReqQuantityVo = new IfReqQuantityVo();
		ifReqQuantityVo.setId(target.getId());
		ifReqQuantityVo.setIfId(target.getHttp().getId());
		ifReqQuantityVo.setReqThreshold(Integer.parseInt(target
				.getRequestThreshold()));
		ifReqQuantityVo.setReqUnit(target.getRequestUnit());
		ifReqQuantityVo.setReqMax(Integer.parseInt(target.getRequestMax()));
		return ifReqQuantityVo;
	}
}